package com.dinzeer.godfox.sa;

import com.dinzeer.legendreliclib.lib.util.FastMakeEntityUtil;
import com.dinzeer.legendreliclib.lib.util.WaitingTick;
import mods.flammpfeil.slashblade.slasharts.Drive;
import mods.flammpfeil.slashblade.util.AttackManager;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.util.thread.SidedThreadGroups;

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;

public class BloodWaveEdge {

    public static void doSlash(LivingEntity playerIn){
         int count= (int) Math.min(((playerIn.getHealth()+ playerIn.getAbsorptionAmount())-5)/2,50);
         System.out.println(count);
         for (int i = 0; i < count; i++){
             WaitingTick.schedule(i, () -> {
                 if (playerIn.getHealth()+ playerIn.getAbsorptionAmount()>5){
                 Drive.doSlash(playerIn,90,100,Vec3.ZERO,false,1,3f);
                 if (playerIn instanceof Player){
                 FastMakeEntityUtil.FastHurt(playerIn,playerIn,2, DamageTypes.GENERIC_KILL);
                 }else {
                   playerIn.setHealth(playerIn.getHealth()-2);
                 }
                 }
             });
         }
    }

}
